package edu.je.prs.util;

import edu.je.prs.vo.EchartsVo;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

/**
 * @Description:
 * @author: Anhlaidh
 * @date: 2021-03-30 19:09
 */
@Service
public class EchartsUtil<K,V> {
    public static List<EchartsVo> mapToList(HashMap<String, Integer> map){
        Iterator<String> iterator = map.keySet().iterator();
        List<EchartsVo> result = new ArrayList<>();
        while (iterator.hasNext()) {
            String key = iterator.next();
            Integer value = map.get(key);
            result.add(new EchartsVo(key, value));
        }
        return result;
    }
    public static <K,V> void copyKey(HashMap<K,V> map, K key, K target) {
        V value = map.get(key);
        map.put(target, value);

    }

}
